package com.stm.basicData.service.impl;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.stm.basicData.domain.KfToolsEquipment;
import com.stm.basicData.mapper.KfToolsEquipmentMapper;
import com.stm.basicData.service.KfToolsEquipmentService;
import com.stm.common.annotation.DataScope;
import com.stm.common.core.text.Convert;

/**
 * 设备录入 服务层实现
 *
 * @author wyc
 * @date 2019-04-08
 */
@Service
public class KfToolsEquipmentServiceImpl implements KfToolsEquipmentService {
	
    @Autowired
    private KfToolsEquipmentMapper kfToolsEquipmentMapper;
    /**
     * 查询设备录入列表
     *
     * @param KfToolsEquipment 设备录入信息
     * @return 设备录入集合
     */
    @Override
	@DataScope(tableAlias = "b2")
    public List<KfToolsEquipment> selectAllPageList(KfToolsEquipment kfToolsEquipment) {
        return kfToolsEquipmentMapper.selectAllPageList(kfToolsEquipment);
    }

    /**
     * 新增设备录入
     *
     * @param KfToolsEquipment 设备录入信息
     * @return 结果
     */
    @Override
    @Transactional
    public int insertSelective(KfToolsEquipment kfToolsEquipment) {
        UUID uuid = UUID.randomUUID();
        kfToolsEquipment.setId(uuid.toString());
        kfToolsEquipment.setCreateDate(new Date());
        return kfToolsEquipmentMapper.insertSelective(kfToolsEquipment);
    }
    
    /**
     * 查询设备录入信息
     *
     * @param id 设备录入ID
     * @return 设备录入信息
     */
    @Override
    public KfToolsEquipment selectByPrimaryKey(String id) {
        return kfToolsEquipmentMapper.selectByPrimaryKey(id);
    }


    /**
     * 修改设备录入
     *
     * @param KfToolsEquipment 设备录入信息
     * @return 结果
     */
    @Override
    @Transactional
    public int updateByPrimaryKeySelective(KfToolsEquipment kfToolsEquipment) {
    	kfToolsEquipment.setUpdateDate(new Date());
        return kfToolsEquipmentMapper.updateByPrimaryKeySelective(kfToolsEquipment);
    }

    /**
     * 删除设备录入对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteByIds(String ids) {
        return kfToolsEquipmentMapper.deleteByIds(Convert.toStrArray(ids));
    }

}
